package com.reflex;

/**
 * 反射
 * Created by zhuangqi on 2016/12/20.
 */
public class ClassTest {
    User u = new User();
    //方式一
    Class c1 = User.class;
    //方式二
    Class c2 = u.getClass();
    //方式三
    Class c3 = Class.forName("com.reflex.User");

    public ClassTest() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
    }

    User user = (User)c1.newInstance();

}
